﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace devtm.AutoMapper
{

    public class BoxItemMap : INotifyPropertyChanged, IDisposable
    {


        public BoxItemMap(ItemMap item)
        {

            this.Object = item;
            this.PropertyChanged += new PropertyChangedEventHandler(BoxItemMap_PropertyChanged);

        }

        private static string[] properties = new string[] { "Cast", "CustomMethodName", "Enable", "NeedMap", "SourceName", "TargetName" };

        void BoxItemMap_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (PropertyChanged != null)
                if (properties.Contains(e.PropertyName))
                    PropertyChanged(this, e);
        }        

        public event PropertyChangedEventHandler PropertyChanged;

        #region Dispose
        
        public void Dispose(bool disposing)
        {
            if (disposing)
            {

            }
            this.PropertyChanged -= new PropertyChangedEventHandler(BoxItemMap_PropertyChanged);
        }

        public void Dispose()
        {
            Dispose(true);
        }

        ~BoxItemMap()
        {
            Dispose(false);
        }

        #endregion


        #region Properties

        public CastType Cast
        {
            get { return Object.TypeCast; }
            set { Object.TypeCast = value; }
        }

        public string CustomMethodName
        {
            get { return Object.CustomMethodName; }
            set { Object.CustomMethodName = value; }
        }

        public bool Enable
        {
            get { return Object.Enable; }
            set { Object.Enable = value; }
        }

        public bool NeedMap
        {
            get { return Object.NeedMap; }
            set { Object.NeedMap = value; }
        }

        public string SourceName
        {
            get { return Object.SourceName; }
            set { Object.SourceName = value; }
        }

        public string TargetName
        {
            get { return Object.TargetName; }
            set { Object.TargetName = value; }
        }

        #endregion

       public ItemMap Object { get; set; }

    }
}
